<?php
//Product Class

class Product
{
	public $id;				//Product ID
    public $name;			//Product Name
    public $price;			//Price
	public $cat;			//Product category / subcat
	public $shortdesc;		//This short description (varchar 255) suits for the product browsing pages
	public $desc;			//This big description (TEXT) suits for product detailed page
	public $sellertype; 	//Member or Professional Store 
	public $sellerID;		//ID of the store / user
	public $weight;			//Weight (as required by project_grades.pdf)
    public $shipping;		//Delivery (seller accepts delivery for this product)
	public $mainpic;		//Main picture (displayed in the product browsing and featured in the product page)
	public $display;		//Display true or false, mentions if the product is still available for browsing or not
	public $stock;			//Stock (for stores, allows to show the product available stock)
	public $pr_date;		//Date since the product was added to website
	public $area;
	
	//Manque Area et Paypal

	
	
	public function __construct($db,$id) 	//Just like the other classes, we choosed to use __construct function to retrieve products rather then building one.
    {										// The product creation function is a regular function
		$reponse = $db->query('SELECT * FROM jktrade_products WHERE pr_id='.$id.'');
		$data = $reponse->fetch();
		
		$this->id=$data['pr_id'];					//Product ID
		$this->name=$data['pr_name'];				//Product Name
		$this->price=$data['pr_price'];			//Price
		$this->cat=$data['pr_cat'];				//Product category / subcat
		$this->shortdesc=$data['pr_shortdesc'];	//This short description (varchar 255) suits for the product browsing pages
		$this->desc=$data['pr_desc'];				//This big description (TEXT) suits for product detailed page
		$this->sellertype=$data['pr_sellertype']; //Member or Professional Store 
		$this->sellerID=$data['pr_sellerID'];		//ID of the store / user
		$this->weight=$data['pr_weight'];			//Weight (as required by project_grades.pdf)
		$this->shipping=$data['pr_shipping'];		//Delivery (seller accepts delivery for this product)
		$this->mainpic=$data['pr_mainpic'];		//Main picture (displayed in the product browsing and featured in the product page)
		$this->display=$data['pr_display'];		//Display true or false, mentions if the product is still available for browsing or not
		$this->stock=$data['pr_stock'];			//Stock (for stores, allows to show the product available stock)
		$this->pr_date=$data['pr_date'];		//Date since the product was added to website
		$this->area=$data['pr_area'];		//Area where the product is expected to be delivered

	}

}

?>